import axios from 'axios'

// 创建axios实例
const apiClient = axios.create({
  baseURL: 'http://192.168.2.13:8081/api',
  timeout: 5000,
  headers: {
    'Content-Type': 'application/json'
  }
})

// 小列表相关API
export const smallListApi = {
  getLists() {
    return apiClient.get('/small-lists')
  },
  search(data) {
    return apiClient.post('/small-lists/search', data)
  },
  reset(id) {
    return apiClient.post(`/small-lists/${id}/reset`)
  },
  delete(id) {
    return apiClient.delete(`/small-lists/${id}`)
  }
}

// 小工作站相关API
export const workstationApi = {
  getRoles() {
    return apiClient.get('/workstation/roles')
  },
  createRole(data) {
    return apiClient.post('/workstation/roles', data)
  },
  updateRole(id, data) {
    return apiClient.put(`/workstation/roles/${id}`, data)
  },
  deleteRole(id) {
    return apiClient.delete(`/workstation/roles/${id}`)
  }
}

// 其他模块的API可以类似定义...

export default apiClient